package jtk.project4.fleet.ibatis.dao;

import java.sql.SQLException;
import java.util.List;

import jtk.project4.fleet.domain.Contacts;

public class ContactDao extends IbatisDao{
	
	public List selectContacts() throws SQLException {
		List selectContacts = null;
			selectContacts =getSqlMap().queryForList("SELECT_ALL_CONTACT", null);
		return selectContacts;
	}

	public int deleteContact(Contacts contact) throws SQLException{
		return (int) getSqlMap().delete("DELETE_CONTACT", contact);
	}
	
	public int updateContact(Contacts contact) throws SQLException{
		return (int) getSqlMap().update("UPDATE_CONTACT", contact);
	}
	
	public Contacts insertContact(Contacts contact) throws SQLException{
		return (Contacts) getSqlMap().insert("INSERT_CONTACT", contact);
	}
		
	/*public static void main (String args[]) throws SQLException{
		Contacts contact;
		contact = new Contacts();
		contact.setEmail("peekho@yahoo.com");
		new ContactDao().insertContact(contact);
	}*/
	
}
